#include<p24fj128ga006.h>
#include<p24fj128ga006.h>
#include <libpic30.h>
#include "dba.h"



void send_1st_report(void)
{
    
    grants_time = changeByte2Long(grants_list[2],grants_list[3],grants_list[4],grants_list[5]);//refer grant list receive 
    grants_length = changeByte2Integer(grants_list[6],grants_list[7]);//length  
    //if((queue_list[0] == 0x01)&&(grants_list[0]==0x01)&&(grants_time == timer_counter32 ))//send report
    if((queue_list[0] == 0x01)&&(grants_time >= timer_counter32 ))//send report
    //if((grants_list[0]==0x01)&&(grants_time >= timer_counter32)&&(queue_list[0] == 0x01))//send report 
    {
       //capture_delay(0x01);//capture time
       //U1TXREG = 'B';      
       REPORT_Normal(); 
       grants_list[0]=0x00;//1st grant       
       queue_list[0] = 0x02;  
       //grants_list[0]=0x00;
       //capture_delay(0x02);//capture time-> send
    }
    
    /*
    if(queue_list[0] == 0x01)//send report 
    {
         //REPORT_Normal();
         REPORT_Normal();
       
  
         queue_list[0] = 0x00;
    }*/
}

       //TX2EN = 0x01;
       //  __delay32(5000);
       //  U2TXREG = 'B';      
       //  __delay32(1500);
       //  TX2EN = 0x00;

